#! /usr/bin/env python
# -*- coding: utf-8 -*-

from playwright.sync_api import Page

from common.base_page import BasePage
from common.logger import logger
from locators.majorHazardSourceSafety.olMonitorWarn.videoPlayback.loc_query import LocQuery


class QueryList(BasePage):

    def __init__(self, page: Page):
        super().__init__(page)
        self.switch_menu('重大危险源安全管理')
        self.switch_menu('在线监测预警')
        self.switch_menu('视频回放')

    def query_video(self, video_type, video_name):
        logger.info('开始视频回放查询测试')
        logger.info('选择视频类型')
        self.select(LocQuery.loc_video_type, video_type)
        logger.info('输入监控名称')
        self.fill(LocQuery.loc_name_input, video_name)
        logger.info('点击查询按钮')
        self.click(LocQuery.loc_query_button)
